package com.zhumeijia.wuye.controller;

import com.zhumeijia.wuye.bean.Location;
import com.zhumeijia.wuye.bean.ResBody;
import com.zhumeijia.wuye.service.LocationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class LocationController {
    private static final Logger LOG = LoggerFactory.getLogger(LocationController.class);
    @Autowired
    LocationService service;

    @GetMapping("/api/getAllLocation")
    public ResBody getAllLocations() {
        ResBody resBody = new ResBody();
        List<Location> list = service.getAllLocation();
        resBody.setData(list);
        resBody.setCode(200);
        LOG.info(list.toString());
        return resBody;
    }


}
